﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Core;
using Microsoft.AspNetCore.Mvc;
using Model;
using NLog;
using Commons;

namespace WebApp.ApiControllers
{
    /// <summary>
    /// 日志接口实例
    /// </summary>
    [Route("api/[controller]/[action]")]
    public class LogController : Controller
    {
        private readonly IBaseService _baseService;
        private readonly Logger log = LogManager.GetCurrentClassLogger();
        /// <summary>
        /// 
        /// </summary>
        /// <param name="baseService"></param>
        public LogController(IBaseService baseService)
        {
            _baseService = baseService;
        }
        /// <summary>
        /// Get
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public JsonResult Get()
        {
            var list = _baseService.GetList<T_Log>(i => true);
            return Json(list);
        }

        /// <summary>
        /// Get
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet("{id}")]
        public JsonResult Get(int id)
        {
            var list = _baseService.GetModel<T_Log>(i => i.Id == id);
            return Json(list);
        }

        /// <summary>
        /// Post
        /// </summary>
        /// <param name="value"></param>
        [HttpPost]
        public void Post([FromBody]string value)
        {
        }

        /// <summary>
        /// Put
        /// </summary>
        /// <param name="id"></param>
        /// <param name="value"></param>
        [HttpPut("{id}")]
        public void Put(int id, [FromBody]string value)
        {
        }

        /// <summary>
        /// Delete
        /// </summary>
        /// <param name="id"></param>
        [HttpDelete("{id}")]
        public void Delete(int id)
        {
        }
    }
}
